[#import "/framework/JGP.htm"  as JGP]
<!--
项目   Bsm
作者   fdp
时间   2018/7/23
-->
[@JGP.head "Title"/]
[@JGP.body]
<jgp-div _row="['8','*','*']" _aux="true">
    <jgp-div slot="1-1" _col="['*','*','*','*']" _runit="px" _aux="false">
        <jgp-query slot="1-1" _target="grid" _id="query" _auto="false" _page_size="5">
            <jgp-text _col="4" _placeholder="人员搜索" _name="name"></jgp-text>
            <jgp-text _col="4" _placeholder="单位搜索" _name="workUnit"></jgp-text>
            <jgp-btn _col="3" _fn="search" _margin="10" >搜</jgp-btn>
        </jgp-query>
        <jgp-btn slot="1-2" _fn="addParticipants" _margin="10">增加人员</jgp-btn>
        <jgp-btn slot="1-3" _fn="" _margin="10">批量导入</jgp-btn>
    </jgp-div>
    <jgp-grid _id="grid" slot="2-1" _onclick="detailInfo"
              _record_tools="[{'icon':'meetup','tip':'参加会议','fn':'addJoinMeeting'},{'icon':'envelope-open-o','tip':'详情','fn':'detailInfo'},{'icon':'edit','tip':'编辑','fn':'editParticipants'},{'icon':'window-restore','fn':'addFields'},{'icon':'times-rectangle','tip':'删除','fn':'removeParticipants'}]"
              _index="true"></jgp-grid>
    <jgp-grid _id="gridDetail" slot="3-1"
              _record_tools="[{'icon':'edit','tip':'编辑','fn':'detailInfo'},{'icon':'window-restore','fn':'addFields'}]"
              _index="true"></jgp-grid>
</jgp-div>
[/@JGP.body]
[@JGP.foot]
<script>
    //页面渲染完成之后调用,列表初始化
    JGP.$onload(search())
    //手动搜索-->
    function search() {
        JGP.query('query').searchTo('/glMeeting/participantsApiController/queryParticipants', function () {
        }, function () {
        });
    }
    //弹出添加人员页面-->
    function addParticipants(re) {
        var config = {
            url: '/glMeeting/participantsController/addParticipant',
            title: "增加人员",
            callback: function (res) {
                if (res == true) {
                    window.location.reload();
                }
            },
            width: '500px',
            height: '600px'
        }
        JGP.$dialog(config)
    }
    //弹出参加会议框
    function addJoinMeeting(re) {
        var config = {
            url: '/glMeeting/usersController/addJoinMeeting/' + re.back.id,
            title: "设置参加会议",
            callback: function (res) {
                if (res == true) {
                    window.location.reload();
                }
            },
            width: '300px',
            height: '200px'
        }
        JGP.$dialog(config)
    }
    //人员详情信息-->
    function detailInfo(re) {
        JGP.grid('gridDetail').load("/glMeeting/relationTableApiController/detailInfo/" + re.back.id)
    }
    //弹出编辑人员的框-->
    function editParticipants(re) {
        var config = {
            url: '/glMeeting/participantsController/editParticipants/' + re.back.id,
            title: "编辑人员",
            callback: function (res) {
                if (res == true) {
                    window.location.reload();
                }
            },
            width: '500px',
            height: '600px'
        }
        JGP.$dialog(config)
    }
    //删除人员（谨慎啊）
    function removeParticipants(re) {
        JGP.$confirm("是否确认删除", function () {
            JGP.$post('/glMeeting/participantsApiController/removeParticipants', {id: re.back.id}, function (res) {
                JGP.$alert("删除成功")
                if (res.flag == true) {
                    window.location.reload();
                }
            })
        })
    }
</script>
[/@JGP.foot]